<?xml version="1.0" encoding="utf-8" ?>

<Project DefaultTargets="DebugBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <PackageName>@ProjectName.wsp</PackageName>
    <PackageFile>@ProjectName.wsp</PackageFile>
    <TargetUrl>http://litwareinc.com</TargetUrl>
    <ProjectDeploymentFilesFolder>@DeploymentFilesFolder</ProjectDeploymentFilesFolder>
    <ProjectRootFilesFolder>@RootFilesFolder</ProjectRootFilesFolder>
    <WssRootFilesFolder>"$(ProgramFiles)\Common Files\Microsoft Shared\web server extensions\12"</WssRootFilesFolder>
    <!-- Modified 3/25/08 RHoward - tokenized system directory -->
    <MAKECAB>"@SystemDirectory\makecab.exe"</MAKECAB>
    <!-- End of 3/25/08 Modification -->
    <STSADM>"$(ProgramFiles)\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm.exe"</STSADM>
    <STSDEV>"@StsDevPath"</STSDEV>
    <!-- Added 3/25/08 RHoward - Surrounded TargetName and SolutionDir with quotes to support spaces there -->
    <REFRESH>$(STSDEV) /refresh "$(TargetName)" "$(SolutionDir)"</REFRESH>
    <!-- End of 3/25/08 Add -->
    <GACUTIL>"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe"</GACUTIL>
    <ISSAPP_SCRIPT>CSCRIPT.EXE C:\WINDOWS\system32\iisapp.vbs</ISSAPP_SCRIPT>
  </PropertyGroup>

  <Target Name="DebugBuild">
    <Message Text="Refreshing Deployment Files..." Importance="high" />
    <!-- Modified 3/25/08 RHoward - Now executing command with quoted arguments to support spaces -->
    <Exec Command="$(REFRESH)" ContinueOnError="true" />
    <!-- End of 3/25/08 Modification -->
    <Message Text="Deleting Solution Package File..." Importance="high" />
    <Delete Files="$(ProjectDeploymentFilesFolder)\$(PackageFile)" ContinueOnError="true" />
    <Message Text="Building Solution Package (Debug Version)" Importance="high" />
    <Exec Command="$(MAKECAB) /F $(ProjectDeploymentFilesFolder)\SolutionPackage.ddf /D CabinetNameTemplate=$(PackageFile)" ContinueOnError="false" />
    <!-- Added 2/6/08 DMann-->
    <Message Text="" Importance="high" />
    <Message Text="Copying WSP file to CAB" Importance="high" />
    <Delete Files="$(ProjectDeploymentFilesFolder)\$(PackageFile).cab" ContinueOnError="true" />
    <Copy SourceFiles="$(ProjectDeploymentFilesFolder)\$(PackageFile)" DestinationFiles="$(ProjectDeploymentFilesFolder)\$(PackageFile).cab" SkipUnchangedFiles="false" />
    <!--End of 2/6/08 Add-->
    <Message Text="" Importance="high" />
  </Target>

  <Target Name="DebugInstall" DependsOnTargets="DebugBuild">
    <Message Text="Installing Solution..." Importance="high" />
    <Exec Command="$(STSADM) -o addsolution -filename $(ProjectDeploymentFilesFolder)\$(PackageFile)" ContinueOnError="true" />
    <Exec Command="$(STSADM) -o execadmsvcjobs" />
    <Message Text="" Importance="high" />
  </Target>

  <Target Name="DebugDeploy" DependsOnTargets="DebugInstall">
    <Message Text="Deploying Solution..." Importance="high" />
    <Exec Command="$(STSADM) -o deploysolution -name $(PackageName) @StsAdmDeployParameters" />
    <Exec Command="$(STSADM) -o execadmsvcjobs" />
    <Message Text="" Importance="high" />
  </Target>

  <Target Name="DebugRedeploy" >
    <Message Text="" Importance="high" />
    <Message Text="Starting sequence of Retract/Delete/Build/Install/Deploy" Importance="high" />
    <CallTarget Targets="DebugRetract" />
    <CallTarget Targets="DebugDelete" />
    <CallTarget Targets="DebugBuild" />
    <CallTarget Targets="DebugInstall" />
    <CallTarget Targets="DebugDeploy" />
    <CallTarget Targets="DebugDeploy" />
    <Message Text="" Importance="high" />
  </Target>

  <Target Name="DebugUpgrade" DependsOnTargets="DebugBuild">
    <Message Text="Updating solution" Importance="high" />
    <Exec Command="$(STSADM) -o upgradesolution -name $(PackageName) -filename $(ProjectDeploymentFilesFolder)\$(PackageFile) @StsAdmUpgradeParameters" />
    <Exec Command="$(STSADM) -o execadmsvcjobs" />
    <Message Text="" Importance="high" />
  </Target>

  <Target Name="DebugRefreshAssemblyInGac" >
    <Message Text="(Re)installing assembly in GAC and recycling app pool" Importance="high" />
    <Exec Command="$(GACUTIL) -if $(TargetPath)" />
    <Exec Command='$(ISSAPP_SCRIPT) /a "SharePointDefaultAppPool" /r' />
    <Message Text="" Importance="high" />
  </Target>

  <Target Name="DebugQuickCopy" >
    <Message Text="Copying Root Files to WSS system folder" Importance="high" />
    <Exec Command='xcopy /e /y "$(ProjectRootFilesFolder)\*" $(WssRootFilesFolder)' />
    <Message Text="" Importance="high" />
  </Target>

  <Target Name="DebugRetract" >
    <Message Text="Retracting Solution" Importance="high" />
    <Exec Command="$(STSADM) -o retractsolution -name $(PackageName) @StsAdmRetractParameters" ContinueOnError="true" />
    <Exec Command="$(STSADM) -o execadmsvcjobs" />
    <Message Text="" Importance="high" />
  </Target>

  <Target Name="DebugDelete" DependsOnTargets="DebugRetract">
    <Message Text="Deleting Solution Package from Farm Solution Package Store" Importance="high"  />
    <Exec Command="$(STSADM) -o deletesolution -name $(PackageName)" ContinueOnError="true" />
    <Exec Command="$(STSADM) -o execadmsvcjobs" />
    <Message Text="" Importance="high" />
  </Target>

  <Target Name="ReleaseBuild" >
    <Message Text="Deleting Pacakge File..." Importance="high" />
    <Delete Files="$(ProjectDeploymentFilesFolder)\SolutionPackage.ddf" ContinueOnError="true" />
    <Message Text="Building Cab File (Release Version)" Importance="high" />
    <Exec Command="$(MAKECAB) /F $(ProjectDeploymentFilesFolder)\SolutionPackage.ddf /D CabinetNameTemplate=$(PackageFile)" ContinueOnError="false" />
    <!-- Added 2/6/08 DMann-->
    <Message Text="" Importance="high" />
    <Message Text="Copying WSP file to CAB" Importance="high" />
    <Delete Files="$(ProjectDeploymentFilesFolder)\$(PackageFile).cab" ContinueOnError="true" />
    <Copy SourceFiles="$(ProjectDeploymentFilesFolder)\$(PackageFile)" DestinationFiles="$(ProjectDeploymentFilesFolder)\$(PackageFile).cab" SkipUnchangedFiles="false" />
    <!--End of 2/6/08 Add-->
    <Message Text="" Importance="high" />
  </Target>

</Project>